#include "startinterface.h"
#include "ui_startinterface.h"

startinterface::startinterface(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::startinterface)
{
    ui->setupUi(this);
    resize(1280,720);

    setWindowTitle("大富翁");
    QIcon windowicon(":/image/icon.jfif");
    setWindowIcon(windowicon);

    //设置qss样式
    QFile file(":/qss/startinterface.qss"); //通过文件路径创建文件对象
    file.open(QFile::ReadOnly); //文件打开方式
    QString str = file.readAll(); //获取qss中全部字符
    this->setStyleSheet(str); //设置样式表

    //背景图片
    QPalette PAllbackground = this->palette();
    QImage ImgAllbackground(":/image/startbackground.jpg");
    QImage fitimgpic=
            ImgAllbackground.scaled(this->width(),
                                    this->height(), Qt::IgnoreAspectRatio);
    PAllbackground.setBrush(QPalette::Window, QBrush(fitimgpic));
    this->setPalette(PAllbackground);

    //帮助按钮
    helpbutton = new QPushButton(this);
    helpbutton->setObjectName("helpbutton");
    helpbutton->setGeometry(0,0,55,55);
    helpbutton->setText("帮助");

    //游戏按钮
    singlegame = new QPushButton(this);
    singlegame->setObjectName("singlegame");
    singlegame->setGeometry(200,350,180,80);
    singlegame->setText("单机游戏");

    onlinegame = new QPushButton(this);
    onlinegame->setObjectName("onlinegame");
    onlinegame->setGeometry(200,450,180,80);
    onlinegame->setText("联机游戏");
}

startinterface::~startinterface()
{
    delete singlegame;
    delete onlinegame;
    delete helpbutton;
    delete ui;
}
